<?php
/**
 * Created by IntelliJ IDEA.
 * User: m1573
 * Date: 2022/7/20
 * Time: 22:15
 */
include("include/util.inc.php");
$username = $_GET["username"];
$password = $_GET["password"];
//echo password_verify("1111aaaa",$hash_pass);

$sql = "SELECT * from users where username='$username'";
$sth = $PDO ->query($sql);
$res = $sth->fetch();

if($res == null){
    echo "user not exist";//not exist
}else{
    if(password_verify($password,$res["password"])){
        session_start();
        $_SESSION["username"]=$username;
        $_SESSION["uid"] = $res["uid"];
        echo "succ";//succ
    }else{
        echo "wrong password";//wrong password
    }
}



?>
